<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>1-定位初步体验</title>
    <style>
        *{
            margin:0;
            padding:0;
        }
        div{
            width: 200px;
            height: 200px;
        }
        div:nth-of-type(1){
            background: red;
        }
        div:nth-of-type(2){
            background: blue;
            margin-top: -100px;
            margin-left: 100px;
        }
        div:nth-of-type(2){
            background: blue;
            /* 绝对定位 */
            position: absolute;
            left: 100px;
            top:100px;
            margin-top: 0;
            margin-left:0;
        }
        p.xjt{
            width: 200px;
            height: 200px;
            background: orange;
            line-height: 200px;
            text-align: center;
            color: #fff;
            font-size: 30px;
            position: static;
        }

    </style>
</head>
<body>
    <!-- 1.绝对定位 -->
    <div></div>
    <div></div>
    <hr>
    <!-- 
        2.静态定位[position:static]
        默认都是静态定位，可省略，它按照标准流进行排列，left/top/right/bottom对它
        免疫
     -->
    <p class="xjt">
        下雨了
    </p>
    <hr>
    <!-- 
        3.相对定位
        position:relative
        1)借助方位left/top...
        2)相对于自己原来的位置移动
        3)没有脱标
     -->
    <style>
        span{
            width: 200px;
            height: 200px;
            background: black;
            display: block;
            position: relative;
            left: 100px;
            top: 100px;
        }
    </style>
    <span></span>
    <div>这是测试...</div>


</body>
</html>